import com.atguigu.spring.pojo.Hello;
import com.atguigu.spring.pojo.Student;
import com.atguigu.spring.pojo.User;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.event.ContextStartedEvent;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class SpringContextText {
    @Test
    public void test01(){
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        Hello hello = context.getBean("sayHello", Hello.class);
        hello.sayHello();
    }
    @Test
    public void test02(){
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        Student studentOne = context.getBean("studentOne", Student.class);
        System.out.println(studentOne.toString());
    }
    @Test
    public void test03(){
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        Student studentTwo = context.getBean("studentTwo", Student.class);
        System.out.println(studentTwo.toString());
    }
    @Test
    public void test04(){
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        Student studentTwo = context.getBean("studentThree", Student.class);
        System.out.println(studentTwo.toString());
    }
    @Test
    public void test05(){
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        Student studentFive = context.getBean("studentFive", Student.class);
        System.out.println(studentFive.toString());
    }
    @Test
    public void test06(){
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        Student studentClazz = context.getBean("studentClazz", Student.class);
        System.out.println(studentClazz.toString());
    }
    @Test
    public void test07(){
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        Student studentClazz = context.getBean("studentClazz", Student.class);
        System.out.println(studentClazz.toString());
    }
    @Test
    public void test08(){
        ApplicationContext context = new ClassPathXmlApplicationContext("spring-scope.xml");
        Student bean1 = context.getBean(Student.class);
        Student bean2 = context.getBean(Student.class);
        System.out.println(bean1.equals(bean2));
    }
    @Test
    public void test09(){
        ApplicationContext context = new ClassPathXmlApplicationContext("userBean.xml");
        User getBean = context.getBean("getUser", User.class);
        System.out.println(getBean.toString());
    }
}
